<?php

declare(strict_types=1);

namespace DreamCat\ControllerParamGen4Laravel\Factory;

use DreamCat\Array2Class\PropertyNameTransInterface;
use DreamCat\Array2Class\TransImpl\CamelCase2UnderLine;
use DreamCat\Array2Class\TransImpl\UnderLine2CamelCase;
use JetBrains\PhpStorm\Pure;

/**
 * 名称转制器工厂
 * @author vijay
 */
class PropertyNameTransFactory
{
    /**
     * 通过模式创建适合的名称转换接口
     * @param int $mode 模式名称
     * @return PropertyNameTransInterface|null
     */
    #[Pure]
    public static function createByMode(int $mode): ?PropertyNameTransInterface
    {
        return match ($mode) {
            1 => new CamelCase2UnderLine(),
            2 => new UnderLine2CamelCase(),
            default => null,
        };
    }
}

# end of file
